<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  div{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    height: 50px;
    text-align: center;
    line-height: 50px;
    border: 1px solid black;
    font-weight: 700;
    font-size: 20px;

  }
</style>
<body>
  <div>123</div>
  <script>
    const div = document.querySelector('div')
    const date = new Date()
    div.innerHTML = date.toLocaleString()
    setInterval(()=>{
    const date = new Date()
    div.innerHTML = `当前时间：${date.toLocaleString()}`
    },1000)
  </script>
</body>
</html>